package com.sphd.emanu.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.config.Constant;
import com.sphd.emanu.pojo.order.Order;
import com.wzutils.BigDisMailUtils;
import com.wzutils.L;
import com.wzutils.TimeUtils;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/6/27 --15:19.
 * @Email 87683202@qq.com
 */
public class VipOrderAdapter extends BaseQuickAdapter<Order, BaseViewHolder> {
    Context context;
    public VipOrderAdapter(@LayoutRes int layoutResId, @Nullable List<Order> data, Context context) {
        super(layoutResId, data);
        this.context=context;
    }

    @Override
    protected void convert(BaseViewHolder helper, Order item) {
        //1-预存款,2-微信,3-支付宝,4-现金,5-银行
        L.e(item.getType()+"------");
        helper
                .setText(R.id.item_order_type, item.getPayType()==1 ? "充"
                        : "现")
                .setBackgroundColor(R.id.item_order_type, ContextCompat.getColor(context,(item.getPayType()==1?R.color.indigo_700:R.color.red)))
                .setText(R.id.item_order_where, "外卖消费")
                .setText(R.id.item_order_time, TimeUtils.dateToString(item.getCreateDate(), TimeUtils.YEAR_MONTH_DAY_HOUR_MIN))
                .setText(R.id.item_order_money,"现金支付："+ BigDisMailUtils.turnTrim(item.getAmountPaid(), Constant.POINT))
                .setText(R.id.item_order_topup, "卡包支付："+BigDisMailUtils.turnTrim(item.getDeposit(), Constant.POINT));


    }
}
